﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DeleteDemo.aspx.cs" Inherits="增删改测试_DeleteDemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../JS/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function getSelectID() {
            var ids = new Array();
            $.each($(".cbBook:checked"), function (i, n) {
                ids.push($(n).val());
            });
            $("#Text1").val(ids.join());
            return ids.length > 0;
            //&& confirm("确认要删除所选择的项么。");
        }
        function CheckAll() {
           var check= document.getElementById("chbAll").checked;
            var arrChk = $("input[name='cbBook']");
            $(arrChk).each(function () {
                this.checked = check;
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   <%-- --%>
    <input id="Text1" type="text" style="width: 100%" runat="server" />
    <asp:Button ID="btnDelete" runat="server" Text="删除" SkinID="btnDel" 
         onclick="btnDelete_Click" OnClientClick="return getSelectID();"/>


    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />


    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" 
        onrowcommand="GridView1_RowCommand" >
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <input id="chbAll" type="checkbox" onclick="CheckAll()" class="cbBook" name="cbCheckAll" value="-1" />
                </HeaderTemplate>
                <ItemTemplate>
                    <input id="Checkbox1" type="checkbox" name="cbBook" class="cbBook" value='<%#Eval("UniqueIdentifier")%>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton ID="LbtnDel" CommandArgument='<%#Eval("UniqueIdentifier")%>' runat="server"
                        Text="删除" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="全局唯一标识量" DataField="UniqueIdentifier" />
            <asp:BoundField HeaderText="单表唯一标识量" DataField="ID" />
            <asp:BoundField HeaderText="名称" DataField="Name" />
            <asp:BoundField HeaderText="编号" DataField="Code" />
            <asp:BoundField HeaderText="创建时间" DataField="CreateDate" />
            <asp:BoundField HeaderText="备注" DataField="Remark" />
        </Columns>
    </asp:GridView>
    </form>
</body>
</html>
